//类似java的类
class User {
    //构造函数
    constructor(name, interests) {
        this.name = name;
        this.interests = interests;
    }

    //相当于User.prototype.greeting
    greeting() {
        console.log('Hi, I\'m ' + this.name + '.');
    }
}

//创建对象
let user = new User('Sunny', ['Traveling', 'Swimming']);
user.greeting();
